package cz.mpelant.msoe.mealchecker.request;

import java.util.Properties;

import org.apache.http.client.methods.HttpUriRequest;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import cz.mpelant.msoe.mealchecker.*;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;
import android.util.Log;

@SuppressWarnings("unused")
public class RequestLogin extends PostRequestType {
	private Context mCtx;
	private String username;
	private String pass;

	public RequestLogin(Context ctx) {
		super("https://msoe.managemyid.com/student/login.php");
		this.mCtx = ctx;
	}

	public RequestLogin(Context ctx, String username, String pass) {
		this(ctx);
		this.pass = pass;
		this.username = username;
	}

	public String getBody() {

		return "user=" + LoginActivity.getUsername(mCtx) + "&pwd=" + LoginActivity.getPassword(mCtx);
	}

	@Override
	public HttpUriRequest getHttpRequest() {
		addHeader("Referer", "https://msoe.managemyid.com/student/login.php");
		addBody(getBody());
		return super.getHttpRequest();
	}

}
